/-app
/-build
/-docs ...
/-docs/types ...
/-docs/types/text ...
/-docs/types/text/base
/-docs/types/text/css
/-docs/types/text/html
/-docs/types/text/js
/-docs/types/text/json
/-docs/types/text/less
/-docs/types/text/md
/-docs/types/text/sass
/-docs/types/text/scrollerView
/-docs/types/text/scss
/-docs/types/text/ts
CodeMirror-ext.css
CodeMirrorDocHandler.ts
api.ts
load.ts
api.ts
listSubmodules.ts
load.ts
DocHost.ts
/-files
/-imports
/-persistence
/-typescript
/-typings
errors.js
functions.ts
index.html
try.js
x
      if (this._validLead + this._validTrail < totalLength / 4) { // if more than 0.75 of the document is modified
 
182
        doc.posFromIndex(this._validLead),
183
        doc.posFromIndex(totalLength - this._validTrail));
184
      
185
      this._retrievedText =
186
        this._retrievedText.slice(0, this._validLead) +
187
        mid +
188
        this._retrievedText.slice(this._retrievedText.length - this._validTrail);
189
      this._validLead = -1;
190
​
191
      
192
      return this._retrievedText;
193
    }
194
​
195
    private _docChanges(docChanges: CodeMirror.EditorChange[]) {
196
​
197
      var doc = this.textDoc.doc;
198
​
199
      var lineCount = doc.lineCount();
200
      var newTotalLength = doc.indexFromPos({
201
        line: lineCount - 1,
202
        ch: doc.getLine(lineCount - 1).length
203
      });
204
​
205
      var changeLead = -1;
206
      var changeTrail = -1;
207
      var deltaLength = 0;
208
      for (var i = 0; i < docChanges.length; i++) {
209
        var ch = docChanges[i];
210
        var removedLength = totalLength(ch.removed);
211
        var addedLength = totalLength(ch.text);
212
        var fromIndex = doc.indexFromPos(ch.from);
213
        var trail = newTotalLength - fromIndex - addedLength;
214
        
215
        deltaLength += addedLength - removedLength;
216
        
217
        if (changeLead < 0) {
218
          changeLead = fromIndex;
219
          changeTrail = trail;
220
        }
221
        else {
222
          changeLead = Math.min(changeLead, fromIndex);
223
          changeTrail = Math.min(changeTrail, trail);
224
        }
225
      }
226
      
227
      if (this._validLead < 0) {
228
        this._validLead = changeLead;
229
        this._validTrail = changeTrail;
230
      }
231
      else {
232
        this._validLead = Math.min(this._validLead, changeLead);
233
        this._validTrail = Math.min(this._validTrail, changeTrail);
234
      }
235
​
236
      var changeSummary = {
237
        lead: changeLead,
238
        mid: this._totalLength - changeLead - changeTrail,
239
        newmid: 0,
240
        trail: changeTrail
241
      };
242
      changeSummary.newmid = changeSummary.mid + deltaLength;
243
​
244
      if (this.textDoc.onChanges) {
245
        this.textDoc.onChanges(docChanges, changeSummary);
246
      }
247
​
248
      this._totalLength = newTotalLength;
249
​
250
      if (this._scrollerModel)
251
        this._scrollerModel.docChanges(docChanges);
252
​
253
      this._saveTimer.interval = (this.moduleObj && this.moduleObj.saveDelay) || saveDelay;
254
      this._saveTimer.reset();
255
​
242:0